package project12;

import java.util.Random;

public class Test {
    public static void main(String[] args) {
        Student[] std=new Student[5];
        Random r=new Random();
        String name="小光";
        for(int i=0;i<5;++i)
        {
            int flag=r.nextInt(5);
            if(flag==0)
            {
                name="小王";
            }
            else if (flag==1)
            {
                name="小李";
            }
            else if (flag==2)
            {
                name="小刚";
            }
            else if (flag==3)
            {
                name="小刘";
            }
            else if (flag==4)
            {
                name="小雯";
            }
            int flag1=r.nextInt(3);
            if(flag1==0)
            std[i]=new English(name,r.nextInt(100),r.nextInt(100),r.nextInt(100),r.nextInt(100));
            else if(flag1==1)
                std[i]=new DepartmentComputer(name,r.nextInt(100),r.nextInt(100),r.nextInt(100),r.nextInt(100),r.nextInt(100));
            else if(flag1==2)
                std[i]=new English(name,r.nextInt(100),r.nextInt(100),r.nextInt(100),r.nextInt(100));
        }
        for(int i=0;i<5;++i)
        {
            System.out.println("姓名："+std[i].getName()+""+" 学号:"+std[i].getOrder()+" 综合成绩："+std[i].getGrade());
        }
    }
}
class Student
{
    private String name;
    private int order;
    double grade;

    public int getOrder() {
        return order;
    }

    public double getGrade() {
        return grade;
    }

    public String getName() {
        return name;
    }


    public Student() {
    }

    public Student(String name, int order) {
        this.name = name;
        this.order = order;
    }

    public void setName(String name) {
        this.name = name;
    }
}
class English extends Student
{
    private double speechgrade;
    private double finaltext;
    private double midterm;
    public English(String name, int order, double speechgrade, double finaltext, double midterm) {
        super(name, order);
        this.speechgrade = speechgrade;
        this.finaltext = finaltext;
        this.midterm = midterm;
        super.grade=this.speechgrade*0.5+this.finaltext*0.25+this.midterm*0.25;
    }

    public double getSpeechgrade() {
        return speechgrade;
    }

    public double getFinaltext() {
        return finaltext;
    }

    public double getMidterm() {
        return midterm;
    }

    public void setSpeechgrade(int speechgrade) {
        this.speechgrade = speechgrade;
    }

    public void setFinaltext(int finaltext) {
        this.finaltext = finaltext;
    }

    public void setMidterm(int midterm) {
        this.midterm = midterm;
    }
}
class DepartmentComputer extends Student
{
    private double Operationalcapabilities;
    private double Englishwriter;
    private double finaltext;
    private double midterm;

    public DepartmentComputer(String name, int order, double operationalcapabilities, double englishwriter, double finaltext, double midterm) {
        super(name, order);
        Operationalcapabilities = operationalcapabilities;
        Englishwriter = englishwriter;
        this.finaltext = finaltext;
        this.midterm = midterm;
        super.grade=this.Englishwriter*0.2+this.finaltext*0.2+this.midterm*0.2+this.Operationalcapabilities*0.4;
    }

    public double getOperationalcapabilities() {
        return Operationalcapabilities;
    }

    public double getEnglishwriter() {
        return Englishwriter;
    }

    public double getFinaltext() {
        return finaltext;
    }

    public double getMidterm() {
        return midterm;
    }

    public double getGrade() {
        return grade;
    }
}
class literature extends Student
{
    private double speechgrade;
    private double crift;
    private double finaltest;
    private double midterm;

    public literature(String name, int order, double speechgrade, double crift, double finaltest, double midterm) {
        super(name, order);
        this.speechgrade = speechgrade;
        this.crift = crift;
        this.finaltest = finaltest;
        this.midterm = midterm;
        super.grade=this.speechgrade*0.35+this.crift*0.35+this.finaltest*0.15+this.midterm*0.15;
    }

    public double getSpeechgrade() {
        return speechgrade;
    }

    public double getCrift() {
        return crift;
    }

    public double getFinaltest() {
        return finaltest;
    }

    public double getMidterm() {
        return midterm;
    }

    public double getGrade() {
        return grade;
    }
}
